package com.aceitunaproject.server.translator;

import com.aceitunaproject.shared.gamelement.Settlement;
import com.aceitunaproject.shared.playerdata.PlayerData;

/**
 * @author Federico Bergstein
 * 
 */
public class SettlementTranslator {

	/**
	 * Translates a server side Settlement to a shared Settlement
	 * 
	 * @param server
	 *            side Settlement
	 * @return shared Settlement
	 */
	// TODO: this seems identical to the unit translator, perhaps unify into
	// entity translator?
	public static Settlement toShared(
			com.aceitunaproject.server.entity.settlement.Settlement from) {
		Settlement to = new Settlement();

		to.setId(from.getId());

		to.setName(from.getName());
		to.setPlayer(new PlayerData());
		to.getPlayer().setName(from.getOwner().getName());
		to.setPositionX(from.getCurrentPosition().x);
		to.setPositionY(from.getCurrentPosition().y);
		to.setPersons(from.getPersons());
		return to;

	}
}
